<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>常德市前列腺疾病研究所</title>
  <meta name="description" content="常德市前列腺疾病研究所">
  <meta name="keywords" content="user">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="../assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="../assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="../assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="../assets/css/admin.css">
  <script src="../assets/js/jquery.min.js"></script>
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->
#if(session.username??==null)
<div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg"><a href="/admin/login">请先登录</a></strong></div>
      </div>
    </div>
    </div>

#else

#@top()
#define topcontent()
#end
<div class="am-cf admin-main">
 #@left()
#define leftcontent()
#end

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">微信</strong> / <small>微信</small></div>
      </div>

      <hr/>

      <div class="am-g">
       <div class="am-u-sm-12 am-u-md-9">
       
       #if(status??==2)
    <button type="button" class="am-btn am-btn-default" type="button" id="doc-gen-qr">绑定微信</button>
   #else
  微信已绑定  <a href="/admin/out">解除绑定</a>
   #end
                        </div>
      </div>
      <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt" style="width: 200; height: 200">
  <div class="am-modal-dialog">
  请扫描二维码
   <iframe width="450" height="450" frameborder=0 scrolling=no id="ifr" ></iframe>
    <div class="am-modal-footer">
      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
      <span class="am-modal-btn" data-am-modal-confirm>扫描成功</span>
    </div>
  </div>
  
</div>
    </div>

    <footer class="admin-content-footer">
      <hr>
      <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>

  </div>
  <!-- content end -->

</div>
#end
<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="/assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="../assets/js/amazeui.min.js"></script>

<script src="../assets/js/app.js"></script>
</body>
<script>
  $(function() {
    $('#doc-gen-qr').on('click', function() {
    	$.ajax({
      		cache: true,
      		type: "POST",
      		url:'/admin/login/weixinlogin',
      		async: false,
      		error: function(request) {
      			alert("Connection error");
      		},
      		success: function(data) {
      			$('#my-prompt').modal({
      		        relatedTarget:$(window.parent.document).find("#ifr").attr("src",data.err),
      		        onConfirm: function(options) {
      		        	$.ajax({
      		  	  		cache: true,
      		  	  		type: "POST",
      		  	  		url:'/admin/listen',
      		  	  		data:{"s":data.s},
      		  	  		async: false,
      		  	  		error: function(request) {
      		  	  			alert("Connection error");
      		  	  		},
      		  	  		success: function(data) {
      		  	  		if(data.err==2){
      		  	  			alert("超时");
      		  	  			window.location.href='/admin/weixin';
      		  	  		}
      		  	  		else if(data.err==1){
      		  	  			alert("绑定成功");
      		  	  				window.location.href='/admin/weixin';
      		  	  			}
      		  	  		}
      		  	  	});
      		        }
      		      });
      		}
      	});
     
    });
  });
</script>
</html>
